<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Insert title here</title>
	</head>

	<e:View id="view">
	    <script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
	    <script type="text/javascript">SkinUtil.getSkin();</script>
	    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_Index" datasetDefinition="DatasetDefinition_zb.dsd" datasetRef="Dataset_Index" pageSize="10" loadDataCommand="Command_Load">
				<e:Field name="indexId" dataType="string" label="指标ID" maxLength="32" required="true" />
				<e:Field name="indexName" dataType="string" label="指标名称" maxLength="100" required="true" />
				<e:Field name="indexDesc" dataType="string" label="指标说明" maxLength="200" />
				<e:Field name="indexType" dataType="string" label="指标类型" maxLength="1" required="true" defaultValue="2" />
				<e:Field name="objectScope" dataType="string" label="适用对象" maxLength="4" dropDown="ListDropDown_objectScope" required="true" />
				<e:Field name="indexUnit" dataType="string" label="计量单位" maxLength="1" visible="false" />
				<e:Field name="precision" dataType="string" label="计量精度" maxLength="1" visible="false" />
				<e:Field name="dataType" dataType="string" label="数据类型" maxLength="1" visible="false" />
				<e:Field name="scale" dataType="string" label="小数位数" maxLength="1" visible="false" />
				<e:Field name="statCycle" dataType="string" label="统计周期" maxLength="1" visible="true" dropDown="ListDropDown_statCycle_0001" />
				<e:Field name="saveDate" dataType="string" label="保存日期" maxLength="1" visible="false" />
				<e:Field name="doDateType" dataType="string" label="处理日期类型" maxLength="1" visible="false" />
				<e:Field name="doDate" dataType="string" label="指定存储日期" maxLength="10" visible="false" />
				<e:Field name="dataSource" dataType="string" label="数据来源" maxLength="1" visible="true" dropDown="ListDropDown_dataSource_0002" />
				<e:Field name="indexLevel" dataType="integer" label="指标级次" maxLength="2" visible="true" />
				<e:Field name="formula" dataType="string" label="计算公式" maxLength="4000" visible="false" />
				<e:Field name="formulaSql" dataType="string" label="计算公式sql" maxLength="4000" visible="false" />
				<e:Field name="sortNo" dataType="integer" label="排序号" maxLength="3" required="true" />
				<e:Field name="status" dataType="string" label="指标状态" maxLength="1" required="true" defaultValue="1" dropDown="ListDropDown_status" />
				<e:Field name="remark" dataType="string" label="备注" maxLength="400" />
			</e:Dataset>
			
			<e:Command id="Command_Save" action="com.longtop.perform.zb.index.web.IndexDlBaseEditAction" method="saveIndex" validateRequired="true"
					showHintInfoOnSuccess="false" onExecuteSuccess="Command_Save_onExecuteSuccess(command)">
				<e:DatasetInfo name="DatasetInfo1" alwayRefreshClient="true" submitType="changes" dataset="Dataset_Index"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Delete" action="com.longtop.perform.zb.index.web.IndexDlListAction" method="deleteIndex" validateRequired="false" 
					showHintInfoOnSuccess="false" onExecuteSuccess="Command_Delete_onExecuteSuccess(command)">
			</e:Command>
			
			<e:ListDropDown id="ListDropDown_status" fixed="true" autoDropDown="true">
				<e:ListDropDownItem name="ListDropDownItem" value="" label="" />
				<e:ListDropDownItem name="ListDropDownItem1" value="1" label="启用" />
				<e:ListDropDownItem name="ListDropDownItem0" value="0" label="停止" />
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_indexType" fixed="true" autoDropDown="true">
				<e:ListDropDownItem name="ListDropDownItem" value="" label="" />
				<e:ListDropDownItem name="ListDropDownItem2" value="2" label="基础指标" />
				<e:ListDropDownItem name="ListDropDownItem3" value="3" label="复合指标" />
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_objectScope" fixed="true" autoDropDown="true">
				<e:ListDropDownItem name="ListDropDownItem1" value="10" label="机构" />
				<e:ListDropDownItem name="ListDropDownItem2" value="01" label="个人"/>
				<e:ListDropDownItem name="ListDropDownItem3" value="11" label="机构，个人" />
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_statCycle_0001" fixed="true" autoDropDown="true">
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_dataSource_0002" fixed="true" autoDropDown="true">
			</e:ListDropDown>
		</div>

		<body>
			<e:Page id="ePage" action="com.longtop.perform.zb.index.web.IndexDlBaseEditAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td valign="top" width="100%">
							<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
								<tr>
									<td>
										<e:GroupBox id="GroupBox1" caption="定量基础指标" style="height: 100%; width:100%;">
											<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
												<tr>
													<td align="center" colspan="4" >
														<e:Button id="Button_Save" caption="保存" style="width: 70px; height: 22px" onClick="Button_Save_onClick()" icon="/images/submit.gif"></e:Button>&nbsp;&nbsp;
														<e:Button id="Button_Delete" caption="删除" style="width: 70px; height: 22px" onClick="Button_Delete_onClick()" icon="/images/delete.gif"></e:Button>&nbsp;&nbsp;
														<e:Button id="Button_Back" caption="返回" style="width: 70px; height: 22px" onClick="Button_Back_onClick()" icon="/images/undo.gif"></e:Button>
													</td>
												</tr>	
												<tr>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexId" caption="指标ID"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexId" dataset="Dataset_Index" field="indexId" editorType="text" style="width:250px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexName" caption="指标名称"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexName" dataset="Dataset_Index" field="indexName" editorType="text" style="width:250px;"></e:Text>
													</td>
												</tr>
												<tr>	
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_objectScope" caption="适用对象"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_objectScope" dataset="Dataset_Index" field="objectScope" style="width:250px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_status" caption="指标状态"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_status" dataset="Dataset_Index" field="status" style="width:250px;"></e:Text>
													</td>
												</tr>
												<tr>	
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexUnit" caption="计量单位"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexUnit" dataset="Dataset_Index" field="indexUnit" style="width:250px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_precision" caption="计量精度"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_precision" dataset="Dataset_Index" field="precision" style="width:250px;"></e:Text>
													</td>
												</tr>
												<tr>	
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_dataType" caption="数据类型"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_dataType" dataset="Dataset_Index" field="dataType" style="width:250px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_scale" caption="小数位数"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_scale" dataset="Dataset_Index" field="scale" style="width:250px;"></e:Text>
													</td>
												</tr>
												<tr>	
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_statCycle" caption="统计周期"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_statCycle" dataset="Dataset_Index" field="statCycle" style="width:250px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_sortNo" caption="排序号"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_sortNo" dataset="Dataset_Index" field="sortNo" style="width:250px;"></e:Text>
													</td>
												</tr>
												<tr>	
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexDesc" caption="指标说明"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexDesc" dataset="Dataset_Index" field="indexDesc" editorType="textArea" style="width:250px;height:50px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_remark" caption="备注"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_remark" dataset="Dataset_Index" field="remark" editorType="textArea" style="width:250px;height:50px;"></e:Text>
													</td>
												</tr>
											</table>
										</e:GroupBox>
									</td>
								</tr>	
							</table>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
	</e:View>
</html>	

<script type="text/javascript">
	//init
	function ePage_onAfterLoadPage(){
		var record = Dataset_Index.getCurrentRecord();
		if(record){
			var indexId = record.getValue("indexId");
			if(indexId != null && indexId != ''){
				var field = Dataset_Index.getField("indexId");
				field.setReadOnly(true);
				indexId.readOnly = true;
			}
		}
	}
	
	//返回
	function Button_Back_onClick(){
		var tabName = "<%=request.getParameter("openerTabName") %>";
			var tabset = $J(parent.TabSet_Apps);
			returnToCustTab(tabset,tabName,true);
	}
	
	//保存
	function Button_Save_onClick(){
		var record = Dataset_Index.getCurrentRecord();
		if(record){
			Command_Save.execute();
		}else{
			alert("没有需要保存的数据");
		}
	}
	
	//删除成功
	function Command_Delete_onExecuteSuccess(command){
		alert("操作成功！");
		Button_Back_onClick();
	}
	
	//操作成功
	function Command_Save_onExecuteSuccess(command){
		alert("操作成功！");
		var indexId = command.parameters.getValue("indexId");
		var record = Dataset_Index.getCurrentRecord();
		if(record){
			if(record.getValue("indexId") == null || record.getValue("indexId") == ""||record.getValue("indexId") == "%@|$"){
				record.setValue("indexId",indexId);
			}
		}
	}
</script>